'''
函数
'''
def pp():
    print("我是重复 逻辑")

def sum(a,b):
    print("两个数的加和: ",(a+b))

def sum(*list):
    sum = 0;
    for li in list:
      sum += li
    print("{}个数的的集合：".format(len(list)),sum)


def div(a,b):
    '''
     除法运算
    :param a:  第一个数
    :param b:  第二个数
    :return: 得数
    '''
    return a / b

def hello(name ,age):
    print("我是{},今年{}".format(name,age))

pp()
numa = 10
numb = 20
sum(numa,numb)

result = div(numa,numb)
print("result: ",result)

# 调用hello
hello("张三",age=19)
hello(age=18 ,name="张三")


sum(10,20,30,40,50)
sum(10,20)

def personInfo(name,age,gender="男"):
    print("我是{},性别:{},今年{}".format(name,gender, age))

personInfo(name="张飞",age=22)
personInfo("张飞",22)
personInfo("花木兰",19,"女")

def sum_and_avg(list):
    sum = 0
    count = 0
    for e in list:
        # 如果元素e是数值
        if isinstance(e, int) or isinstance(e, float):
            count += 1
            sum += e
    return sum, sum / count

print(sum_and_avg([10,20,30,40]))



